package com.sheep.jucdemo.part11.part11_7;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Date 2022/5/31 20:43
 * @Created by sheep
 */
public class Test11_7_2_2 {
    static ThreadPoolExecutor executorOne = new ThreadPoolExecutor(5,5,1, TimeUnit.MINUTES,new LinkedBlockingDeque<>(),new NamedThreadFactory("接受用户链接模块"));
    static ThreadPoolExecutor executorTwo = new ThreadPoolExecutor(5,5,1, TimeUnit.MINUTES,new LinkedBlockingDeque<>(),new NamedThreadFactory("具体处理用户请求模块"));

    public static void main(String[] args) {
        // 接受用户链接模块
        executorOne.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("接受用户链接线程");
                throw new NullPointerException();
            }
        });
        // 具体处理用户请求模块
        executorTwo.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("具体处理用户请求模块");
            }
        });

        executorOne.shutdown();
        executorTwo.shutdown();
    }

}
